/*
 * =====================================================================================
 *
 *       Filename:  variance.cpp
 *
 *    Description:  Returns x- and y-variance of character (central moments mu_20
 *                  and mu_02)
 *
 *        Version:  1.0
 *        Created:  13/07/12 15:59:10
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Moos Hueting (mh), mooshueting@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#include <iostream>
#include <cv.h>
#include <highgui.h>

using namespace std;
using namespace cv;

float variance(Mat src, char xy) {
    Moments m = moments(src, true);

    if (xy == 0) {
        // return x-variance
        return m.mu20 / m.m00;
    } else {
        return m.mu02 / m.m00;
    }
}
